// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "common/refactor/common-refactor.scss" as *;
@use "common/refactor/common-dashboard";

.dashboard-fonts {
  border-top: $s-1 solid var(--color-background-quaternary);
  display: flex;
  flex-direction: column;
  padding-left: $s-120;
  overflow-y: auto;
  padding-bottom: $s-120;

  .btn-primary {
    font-size: $fs-11;
    height: $s-32;
    min-width: $s-100;
  }
}

.dashboard-installed-fonts {
  max-width: $s-1000;
  width: 100%;
  display: flex;
  margin-top: $s-24;
  flex-direction: column;

  h3 {
    font-size: $fs-14;
    color: var(--color-foreground-secondary);
    margin: $s-4;
  }

  .font-item {
    color: var(--color-background-secondary);
  }
}

.installed-fonts-header {
  align-items: center;
  color: var(--color-foreground-secondary);
  display: flex;
  font-size: $fs-12;
  height: $s-40;
  padding-left: $s-24;
  text-transform: uppercase;

  > .family {
    min-width: $s-200;
    width: $s-200;
  }

  > .variants {
    padding-left: $s-12;
  }
}

.search-input {
  display: flex;
  flex-grow: 1;
  justify-content: flex-end;

  input {
    background-color: var(--color-background-tertiary);
    border-color: transparent;
    border-radius: $br-8;
    border: $s-1 solid transparent;
    color: var(--color-foreground-primary);
    font-size: $fs-14;
    height: $s-32;
    margin: 0;
    padding: 0 $s-8;
    width: $s-152;

    &:focus {
      outline: $s-1 solid var(--color-accent-primary);
    }
    &::placeholder {
      color: var(--color-foreground-secondary);
    }
  }
}

.font-item {
  align-items: center;
  background-color: var(--color-background-tertiary);
  border-radius: $br-4;
  color: var(--color-foreground-secondary);
  display: flex;
  font-size: $fs-14;
  justify-content: space-between;
  margin-top: $s-4;
  max-width: $s-1000;
  padding: $s-12 $s-24;
  width: 100%;

  input {
    border: $s-1 solid transparent;
    margin: 0;
    padding: $s-8;

    background-color: var(--color-background-tertiary);
    border-radius: $br-8;
    color: var(--color-foreground-primary);
    font-size: $fs-14;

    &:focus {
      outline: $s-1 solid var(--color-accent-primary);
    }
  }

  > .family {
    min-width: $s-200;
    width: $s-200;
  }

  > .filenames {
    min-width: $s-200;
  }

  > .variants {
    font-size: $fs-14;
    display: flex;
    flex-wrap: wrap;
    flex-grow: 1;
    padding-left: $s-16;

    .variant {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: $s-8 $s-12;
      cursor: pointer;

      .icon {
        display: flex;
        height: $s-16;
        width: $s-16;
        margin-left: $s-6;
        align-items: center;
        svg {
          fill: none;
          width: $s-12;
          height: $s-12;
          transform: rotate(45deg);
        }
      }

      &:hover {
        .icon svg {
          stroke: var(--color-foreground-secondary);
        }
      }
    }
  }

  .table-field {
    color: var(--color-foreground-primary);
    .variant {
      background-color: var(--color-background-quaternary);
      border-radius: $br-8;
      margin-right: $s-4;
      padding-right: $s-4;
    }
  }

  .filenames {
    display: flex;
    flex-direction: column;
    font-size: $fs-12;
  }

  .options {
    display: flex;
    justify-content: flex-end;
    min-width: $s-180;

    .icon {
      width: $s-24;
      cursor: pointer;
      display: flex;
      margin-left: $s-12;
      justify-content: center;
      align-items: center;
      svg {
        width: $s-16;
        height: $s-16;
        stroke: var(--color-foreground-secondary);
        fill: none;
      }

      &.failure {
        margin-right: $s-12;
        svg {
          stroke: var(--element-foreground-warning);
        }
      }

      &.close {
        background: none;
        border: none;
        svg {
          stroke: var(--color-foreground-secondary);
        }
      }
    }
  }
}

.dashboard-fonts-upload {
  max-width: $s-1000;
  width: 100%;
  display: flex;
  flex-direction: column;

  .upload-button {
    width: $s-100;
  }

  .btn-secondary {
    margin-left: $s-12;
  }
}

.dashboard-fonts-hero {
  font-size: $fs-14;
  padding: $s-32 0;
  margin-top: $s-80;
  display: flex;
  justify-content: space-between;

  .btn-primary {
    height: $s-40;
    width: 100%;
  }

  .desc {
    display: flex;
    flex-direction: column;
    gap: $s-24;
    color: var(--color-background-secondary);
    width: $s-500;

    h2 {
      color: var(--color-foreground-primary);
      font-weight: 400;
    }
    p {
      color: var(--color-foreground-secondary);
      font-size: $fs-16;
    }
  }

  .btn-primary {
    flex-shrink: 0;
  }
}

.fonts-placeholder {
  align-items: center;
  border-radius: $br-8;
  border: $s-1 solid var(--color-background-quaternary);
  display: flex;
  flex-direction: column;
  height: $s-160;
  justify-content: center;
  margin-top: $s-16;
  max-width: $s-1000;
  width: 100%;

  .icon svg {
    stroke: var(--color-foreground-secondary);
    fill: none;
    width: $s-32;
    height: $s-32;
  }

  .label {
    color: var(--color-foreground-secondary);
    font-size: $fs-14;
  }
}
